﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="edit.aspx.cs" Inherits="He.Web.manage.attrfield.edit" %>

<%@ Register Src="../_uc/head_edit.ascx" TagPrefix="uc" TagName="head_edit" %>
<%@ Register Src="../_uc/head.ascx" TagPrefix="uc" TagName="head" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>编辑扩展字段</title>
    <uc:head runat="server" ID="uchead" />
    <uc:head_edit runat="server" ID="uchead_edit" />
    <link href="../../plug/artDialog/skins/default.css" rel="stylesheet" type="text/css" />
    <script src="../../plug/artDialog/artDialog.js" type="text/javascript"></script>
    <script type="text/javascript">
        function showHiddenDiv() {
            art.dialog({
                title: '添加扩展字段选项值',
                content: document.getElementById('hiddenDiv'),
                width: '500px',
                button: [
                {
                    name: '确定',
                    focus: true
                }
            ]
            });
        }
        function delAttrItem(attrItemId) {
            $.ajax({
                type: "get",
                url: "../../tools/attr.ashx",
                data: "action=delAttrItem&attrItemId=" + attrItemId + "&random=" + Math.random(),
                success: function (data) {
                    if (data.msg == 0) {
                        alert(data.msgbox);
                    }
                    if (data.msg == 1) {
                        location.reload();
                    }
                },
                error: function (data, status, e) {
                    alert(e);
                },
                dataType: "json"
            });
        }
        function validName(obj) {
            var nameReg = /^\w+$/i;
            if (!nameReg.test(obj.value)) {
                alert("字段名只能是字母数字和下划线组成，请重新填写！");
                obj.value = "";
                return false;
            }

        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div class="navigation">
        <span class="back"><a href="list.aspx?channel_id=<%=channel_id %>">返回列表</a></span><b>您当前的位置：首页
            &gt; 扩展字段管理 &gt; 编辑扩展字段</b>
    </div>
    <div class="spClear">
    </div>
    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="msgtable">
        <tr>
            <th colspan="3" align="left">
                编辑扩展字段
            </th>
        </tr>
        <tr>
            <td width="25%" align="right">
                字段标题
            </td>
            <td width="40%">
                <asp:TextBox ID="txtTitle" runat="server" CssClass="input required" size="30" MaxLength="50"
                    HintTitle="扩展字段的标题" HintInfo="请填写字段的标题，如“规格”，小于50个字符。"></asp:TextBox>
            </td>
            <td>
                *中文标题，做为备注
            </td>
        </tr>
        <tr>
            <td align="right">
                字段列名
            </td>
            <td>
                <asp:TextBox ID="txtName" runat="server" CssClass="input required" size="30" MaxLength="50"
                    HintTitle="扩展字段的列名" HintInfo="请填写字段的列名，字母、下划线，不可修改。" onchange="validName(this)"></asp:TextBox>
            </td>
            <td>
                *字母、下划线，添加后不可修改<br /><font color="#ff0000">注意：若为英文版，请保持与中文版一致，以便在数据对拷时能同步拷贝扩展字段</font>
            </td>
        </tr>
        <tr>
            <td align="right">
                控件类型
            </td>
            <td>
                <asp:DropDownList ID="ddlControlType" CssClass="required" runat="server" AutoPostBack="true"
                    OnSelectedIndexChanged="ddlControlType_SelectedIndexChanged">
                    <asp:ListItem Value="">请选择控件类型</asp:ListItem>
                    <asp:ListItem Value="single-text">单行文本</asp:ListItem>
                    <asp:ListItem Value="multi-text">多行文本</asp:ListItem>
                    <asp:ListItem Value="number">数字</asp:ListItem>
                    <asp:ListItem Value="editor">编辑器</asp:ListItem>
                    <asp:ListItem Value="checkbox">复选框</asp:ListItem>
                    <asp:ListItem Value="multi-radio">多项单选</asp:ListItem>
                    <asp:ListItem Value="multi-checkbox">多项多选</asp:ListItem>
                    <asp:ListItem Value="images">图片上传</asp:ListItem>
                </asp:DropDownList>
            </td>
            <td>
                *添加后不可修改
            </td>
        </tr>
        <tr>
            <td align="right">
                属性
            </td>
            <td>
                <asp:CheckBox ID="cbIsRequired" runat="server" Text="必填" />
                <asp:CheckBox ID="cbIsLock" runat="server" Text="隐藏" />
            </td>
            <td>
            </td>
        </tr>
        <asp:Panel ID="pAttrItems" runat="server">
            <tr>
                <td align="right">
                    选项列表
                </td>
                <td>
                    <asp:Literal ID="litAttrItems" runat="server"></asp:Literal>
                    <a href="javascript:;" onclick="showHiddenDiv()">添加<img src="../images/action_add.gif" /></a>
                    <div id="hiddenDiv" style="display: none; width: 500px;">
                        <dl>
                            <dt style="float: left;"><font color="#ff0000">*</font>属性值：</dt>
                            <dd style="float: left;">
                                <asp:TextBox ID="txtAttrItems" runat="server" CssClass="textarea wh380" TextMode="MultiLine"></asp:TextBox><br />
                                <br />
                                扩展字段的选项，以回车换行为一行。
                                <br />
                            </dd>
                        </dl>
                    </div>
                </td>
                <td>
                </td>
            </tr>
        </asp:Panel>
        <tr>
            <td align="right">
                默认值
            </td>
            <td>
                <asp:TextBox ID="txtDefaultValue" runat="server" CssClass="input" size="30" MaxLength="50"
                    HintTitle="默认值" HintInfo="请填写控件的默认字符。"></asp:TextBox>
            </td>
            <td>
                *控件的默认字符，可为空
            </td>
        </tr>
        <asp:Panel ID="pEditorType" runat="server">
            <tr>
                <td align="right">
                    编辑器类型
                </td>
                <td>
                    <asp:RadioButtonList ID="rblEditorType" runat="server" RepeatDirection="Horizontal"
                        RepeatLayout="Flow">
                        <asp:ListItem Value="0" Selected="True">标准型</asp:ListItem>
                        <asp:ListItem Value="1">简洁型</asp:ListItem>
                    </asp:RadioButtonList>
                </td>
            </tr>
        </asp:Panel>
        <tr>
            <td align="right">
                提示信息
            </td>
            <td>
                <asp:TextBox ID="txtTipMsg" runat="server" TextMode="MultiLine" CssClass="textarea wh380"
                    HintTitle="字段的提示信息" MaxLength="250" HintInfo="字段的提示信息，当用户输入时给予的提示信息，最多250个字符。"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td align="right">
                排序
            </td>
            <td>
                <asp:TextBox ID="txtSortId" CssClass="input required number" size="10" runat="server"
                    MaxLength="9" HintTitle="扩展字段的排列顺序" HintInfo="纯数字，数字越少越向前。">99</asp:TextBox>
            </td>
        </tr>
    </table>
    <div style="margin-top: 10px; text-align: center;">
        <asp:Button ID="btnSave" runat="server" Text="确认保存" CssClass="submit" OnClick="btnSave_Click" />
        &nbsp;&nbsp;
        <input type="reset" name="button" id="btnReset" value="重 置" class="submit" />
    </div>
    </form>
</body>
</html>
